package msi.gama.display.java3d.notused;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;

import msi.gama.display.java3d.renderingObject.RenderingObject;

//TODO minhvv REMOVE not used

public class RenderingList {
	private static HashMap<String, RenderingObject> addingAgents =
			new HashMap<String, RenderingObject>();
	private static HashMap<String, RenderingObject> renderingAgents =
			new HashMap<String, RenderingObject>();

	public static void addNewRenderingAgent(String agentName, RenderingObject renderingObj) {
		if (!addingAgents.containsKey(agentName)) {
			addingAgents.put(agentName, renderingObj);
		}
	}

	public static void moveNewAgentsToRenderingList() {
		if (addingAgents.isEmpty()) {
			return;
		}

		Iterator<Entry<String, RenderingObject>> iterator =
				addingAgents.entrySet().iterator();

		while (iterator.hasNext()) {
			Entry<String, RenderingObject> entry = iterator.next();
			String addingObjectName = entry.getKey();
			RenderingObject addingObjectRendering = entry.getValue();

			if (!renderingAgents.containsKey(addingObjectName)) {
				renderingAgents.put(addingObjectName, addingObjectRendering);
			}

		}

		addingAgents.clear();
	}

	public static void clearFlagsOnRenderingList() {
		/*
		 * for(Map.Entry<Integer, String> entry : map.entrySet()){
		 * System.out.printf("Key : %s and Value: %s %n", entry.getKey(),
		 * entry.getValue()); }
		 */

		/*
		 * Iterator<Map.Entry<Integer, String>> iterator =
		 * map.entrySet().iterator(); while(iterator.hasNext()){
		 * Map.Entry<Integer, String> entry = iterator.next();
		 * System.out.printf("Key : %s and Value: %s %n", entry.getKey(),
		 * entry.getValue()); iterator.remove(); // right way to remove entries
		 * from Map, // avoids ConcurrentModificationException }
		 */

		/*
		 * Iterator it = mp.entrySet().iterator(); while (it.hasNext()) {
		 * Map.Entry pairs = (Map.Entry)it.next();
		 * System.out.println(pairs.getKey() + " = " + pairs.getValue());
		 * it.remove(); // avoids a ConcurrentModificationException }
		 */

		Iterator<Entry<String, RenderingObject>> iterator =
				renderingAgents.entrySet().iterator();
		while (iterator.hasNext()) {
			Entry<String, RenderingObject> entry = iterator.next();
			RenderingObject currentObj = entry.getValue();
			// currentObj.clearObjectFlags();
		}
	}
}
